import { ref, reactive } from 'vue'
import { getPayRecordsAPI } from '@/api/order'
export function usePayRecordsData() {
    const list =  reactive([
        {
            name: '我的支出',
            value: 0
        },
        {
            name: '我的收入',
            value: 1
        },
        {
            name: '我的充值',
            value: 2
        }
    ]);
    const active = ref(0)
    const loading = ref(false)
    const recordData = ref([])
    function getpayRecordData (typeId) {
        loading.value = true
        getPayRecordsAPI(typeId).then(res => {
            recordData.value = res.records
        }).finally(_=> {
            loading.value = false
        })
    }
    return {
        list,
        active,
        getpayRecordData,
        recordData,
        loading
    }
}
